package com.my.test.jvm;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class TestThread {

	public static void createBusyThread() {
		Thread t = new Thread(new Runnable() {
			@Override
			public void run() {
				while (true) {
					;
				}
			}
		}, "testBusyThread");
		t.start();
	}

	public static void createLockThread(final Object lock) {
		Thread t = new Thread(new Runnable() {
			@Override
			public void run() {
				synchronized (lock) {
					try {
						lock.wait();
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		});
		t.start();
	}
	
	public static void main(String[] args) throws IOException {
		InputStreamReader in = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(in);
		br.readLine();
		createBusyThread();
		br.readLine();
		Object obj = new Object();
		createLockThread(obj);
	}

}
